#!/usr/bin/env python3
# _*_ coding: utf-8 _*_


from ctypes import *


if __name__ == '__main__':
	demo = cdll.LoadLibrary("./libdemo_dll.dylib")

	# 以下两方法皆可,但需显式说明c_ubyte数组的大小,个人感觉不方便，求指导
    # library.arrayTest.argtypes = [c_char_p, c_ubyte*16]
	demo.arrayTest.argtypes = [c_char_p, POINTER(c_ubyte * 16)]
	demo.arrayTest.restype = c_void_p

	# python2
	# str_info = create_string_buffer("Fine,thank you")

	# python3, str都是unicode格式，需转为其余编码，可使用encode函数或b前缀
    # 以下两种方法皆可
	str_info = create_string_buffer(b"Fine, thank you")
	# str_info = create_string_buffer("Fine, thank you".encode('utf-8'))
	# 调用类型需配套
	u_str_info = (c_ubyte * 16).from_buffer_copy(b'345678fghj')

	demo.arrayTest(str_info, byref(u_str_info))
